Page({
  data: {
    tab_name:[
      {
        id: 0,
        name: '话题',
        url: '/image/message/icon/topic_icon.png'
      },
      {
        id: 1,
        name: '爪迹',
        url: '/image/message/icon/cat_claw_icon.png'
      },
      {
        id: 2,
        name: '消息',
        url: '/image/message/icon/message_icon.png'
      },
      {
        id: 3,
        name: '公告',
        url: '/image/message/icon/announcement.png'
      }
    ],
    currentData: 0
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  },
  //获取当前滑块的index
  bindchange: function (e) {
    const that = this;
    that.setData({
      currentData: e.detail.current
    })
  },
  //点击切换，滑块index赋值
  checkCurrent: function (e) {
    const that = this;

    if (that.data.currentData === e.target.dataset.current) {
      return false;
    } else {

      that.setData({
        currentData: e.target.dataset.current
      })
    }
  }
})